function opera(id){
    confirm("你确定商家已付款？",function () {
        confirm("真的确定吗？",function () {
            //审核通过
            var param={
                "id":id
            }
            var url = '/manage/confirm';
            $.ajax({
                type: "POST",
                url: baseURL + url,
                dataType: "json",
                async: true,
                contentType:"application/json",
                data:JSON.stringify(param),
                success: function(r){
                    if (r.code===0) {
                        alert("操作成功！",function () {
                            window.location.reload();
                        });
                    }else{
                        alert(r.info);
                    }
                }
            });
        })
    })
}
$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + '/manage/chargeRecordList',
        datatype: "json",
        colModel: [         
        { label: 'ID', name: 'id', width: 30, key: true },
        { label: '用户名', name: 'username', width: 30 },
        { label: '金额', name: 'sum', width: 30 },
        { label: '类型', name: 'type', width: 30 },
        { label: '是否活动', name: 'isActivity', width: 30 ,formatter: function(value, options, row){
                    if(value){
                        return '是';
                    }else{
                        return '否';
                    }
                }},
        { label: '操作', width: 30 ,formatter: function(value, options, row){
            if(row.status !=0){
                return '已处理';
            }else{
                return '<button type="button" class="btn btn-warning " onclick="opera('+row.id+')">审核通过</button>';
            }
        }},
        ],
        viewrecords: true,
        height: 555,
        rowNum: 10,
        rowList : [10,30,50],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "data.dataList",
            page: "data.total",
            records: "page.totalNum"
        },
        prmNames : {
            page:"pageNo", 
            rows:"pageSize", 
            order: "order"
        },
        gridComplete:function(){
            //隐藏grid底部滚动条
            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        }
    });
});
var vm = new Vue({
    el:'#rrapp',
    data:{
        q:{
            key: null
        },
        showList: true,
        title: null
    },
    methods: {
        reload: function () {
            vm.showList = true;
            var page = $("#jqGrid").jqGrid('getGridParam','page');
            $("#jqGrid").jqGrid('setGridParam',{ 
                postData:{'key': vm.q.key},
                page:page
            }).trigger("reloadGrid");
        }
    }
});